<template>
    <view>
       <view class="wrap">
       	 <view class="wrap-list">
			 <uni-title class="title-top">请填写您所修改项</uni-title>
       	 	<view class="uni-common-mt">
       	 		<view class="uni-form-item uni-column">
       	 		    <view class="title">出发时间</view>
       	 		    <input class="uni-input" v-model="userList.setoffTime"/>
       	 		</view>
       	 		<view class="uni-form-item uni-column">
       	 		    <view class="title">乘车地点</view>
       	 		    <input class="uni-input" v-model="userList.setoffAddress" />
       	 		</view>
       	 		<view class="uni-form-item uni-column">
       	 		    <view class="title">到达地点</view>
       	 		    <input class="uni-input" v-model="userList.arrivalAddress" />
       	 		</view>
				<view class="btn">
					<button type="default" @click="submit">确认修改</button>
				</view>
       	 	</view>
       	 </view>
       </view>
    </view>
</template>

<script>
	export default {
		data() {
			return {
				orderId:'',
				token:'',
				userList:{
					setoffTime:'',
					setoffAddress:'',
					arrivalAddress:'',
				}
				
			}
		},
		onLoad(options) {
			var that = this
			var orderId = options.orderid
			that.orderId= orderId
			console.log(orderId)
		    let token = uni.getStorageSync('userinfo').token	
			//获取订单详情
			uni.request({
				url:'http://192.168.101.7:8080/order/getDetail',
				method:'post',
				data:{
					orderId: that.orderId,
				},
				success: (res) => {
					console.log(res)
					var userList = res.data
					that.userList = userList
					console.log(that.userList)
				}
			})
		},
		methods: {
			submit(){
                let order = this.userList;
                console.log(JSON.stringify(order))
				uni.request({
					url:'http://192.168.101.7:8080/order/updDemandInOrder',
					method:'POST',
					data: {
						order,
						orderId: this.orderId,
					},
					success: (res) => {
						console.log(res)
						uni.switchTab({
							url:'../index/index'
						})
						 // uni.navigateTo({
						 // 	url:'../bus-list/bus-list'
						 // })
					}
				})
			}
		}
	}
</script>

<style>
@import url("./updataMessage.css");
</style>
